package com.vehicle.util;

import com.vehicle.bean.UserLog;
import com.vehicle.mapper.UserLogMapper;
import org.springframework.beans.factory.annotation.Autowired;

public class LogUtil {

    //用户插入
    public static UserLog insertUserInsert(Integer id,String content,String address,String success){
        UserLog userLog = new UserLog();
        userLog.setUserId(id);
        userLog.setContent(content);
        userLog.setIpAddress(address);
        userLog.setSuccess(success);
        userLog.setType("添加");
        return userLog;
    }
    //管理员插入
    public static UserLog insertAdminInsert(Integer id,String content,String address,String success){
        UserLog userLog = new UserLog();
        userLog.setAdminId(id);
        userLog.setContent(content);
        userLog.setIpAddress(address);
        userLog.setSuccess(success);
        userLog.setType("添加");
        return userLog;
    }
    //用户删除

    public static UserLog insertUserDelete(Integer id,String content,String address,String success){
        UserLog userLog = new UserLog();
        userLog.setUserId(id);
        userLog.setContent(content);
        userLog.setIpAddress(address);
        userLog.setSuccess(success);
        userLog.setType("删除");
        return userLog;
    }

    //管理员删除
    public static UserLog insertAdminDelete(Integer id,String content,String address,String success){
        UserLog userLog = new UserLog();
        userLog.setAdminId(id);
        userLog.setContent(content);
        userLog.setIpAddress(address);
        userLog.setSuccess(success);
        userLog.setType("删除");
        return userLog;
    }

    //用户修改
    public static UserLog insertUserUpdate(Integer id,String content,String address,String success){
        UserLog userLog = new UserLog();
        userLog.setUserId(id);
        userLog.setContent(content);
        userLog.setIpAddress(address);
        userLog.setSuccess(success);
        userLog.setType("修改");
        return userLog;
    }

    public static UserLog insertAdminUpdate(Integer id,String content,String address,String success){
        UserLog userLog = new UserLog();
        userLog.setUserId(id);
        userLog.setContent(content);
        userLog.setIpAddress(address);
        userLog.setSuccess(success);
        userLog.setType("删除");
        return userLog;
    }
}
